# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils qt4 subversion flag-o-matic cmake-utils

DESCRIPTION="$PN package and theme installer for qutIM"
HOMEPAGE="http://qutim.org"
ESVN_REPO_URI="http://qutim.org/svn/plugman/trunk"
LICENSE="GPL-2"

SLOT="live"
KEYWORDS=""
IUSE="debug tools"

RDEPEND="net-im/qutim:live
	sys-libs/zlib"

DEPEND="${DEPEND}
	>=dev-util/cmake-2.6
	!x11-plugins/qutim-plugman:0.2"

RESTRICT="debug? ( strip )"

src_unpack()
{
	subversion_src_unpack
}

src_prepare() 
{
	if (use debug) ; then
		unset CFLAGS CXXFLAGS
		append-flags -O1 -g -ggdb
	fi
	append-flags -fPIC

	if (use tools) ; then
		mycmakeargs="-DTOOLS=true"
	fi

	mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=/usr -DAPPLE=0 -DUNIX=1"

	CMAKE_IN_SOURCE_BUILD=1

	sed -i "/DESTINATION/s/lib/$(get_libdir)/g" ${S}/CMakeLists.txt
}

src_install()
{
	cmake-utils_src_install
}
